import 'about.dart';
import 'cupertinoPageRoute.dart';
import 'detail.dart';
import 'router.dart';
import 'unknown.dart';
import 'package:flutter/material.dart';

class RouterManager {
  static final Map<String, WidgetBuilder> routers = {
    HomePage.routerName: (context) => HomePage(),
    HomeAbout.routerName: (context) => HomeAbout(),
    RightBackDemo.routerName : (context) => RightBackDemo(),
  };

  static final String initialRoute = HomePage.routerName;

  static final RouteFactory generateRouter = (settings){
    if (settings.name == HomeDetailPage.routerName) {
      return MaterialPageRoute(builder: (context) {
        return HomeDetailPage(settings.arguments);
      });
    }
    return null;
  };

  static final RouteFactory unknownRouter = (RouteSettings settings){
    return MaterialPageRoute(
        builder: (context){
          return UnknownPage();
        }
    );
  };
}
